You are here: Building the Model: General Elements > Pre-defined Tank Subroutines > Tank_Rate > Description
ProModel calls this subroutine automatically if you pass a 0 value as the From Rate when using the Tank_Empty or Tank_Transfer subroutine. To return the desired rate value, enter the necessary logic in the subroutine—ProModel calls the subroutine with each time step. A return value of 0 terminates the flow and returns the remaining amount in the Tank_QtyLeft variable.
Components
<FROM Tank>
The name or location index number of the FROM tank (this value should be 0 if there is no FROM tank).
<TO Tank>
The name or location index number of the TO tank (this value should be 0 if there is no TO tank).
Example
TankA fills with 10,000 gallons at a rate of 60 gpm until it reaches a level of 9,700 gallons. Then it fills at a rate of 30 gpm. To model this change of rate, define the following logic in the Tank_Rate subroutine:
IF Tank_ToID=TankA
THEN IF Tank_Level[TankA]<9700
THEN RETURN 60
ELSE RETURN 30
Now when you fill TankA, enter the following:
Tank_Fill(TankA, 10000, 0, 0)
The first 0 in the expression above causes the logic defined in the Tank_Rate subroutine to execute and determine the flow rate.